<template>
	<view>
		<view class="wentisch">
			<view class="wTitle">{{list.post_title}}</view>
			<view class="wInfo " :class="sets ? '':'textline1'">{{list.post_content}}</view>
			<view class="orimg">
				<image v-for="val in list.images" mode="aspectFit" :src="val"></image>
			</view>
			<view class="acea-row row-between-wrapper">
				<view class="time">{{list.published_time}}</view>
				<view class="genduo acea-row row-center-wrapper" @click="zhankai">
					<view>{{sets?'收起':'展开'}}描述 </view>
					<image src="../../static/xiazia.png" mode=""></image>
				</view>
			</view>
		</view>

		<view class="huida" v-if="list.post_reply != null">
			<view class="headers acea-row row-between-wrapper">
				<view>回答</view>
				<image src="../../static/gfang.png"></image>
			</view>
			<view class="hInfos" v-html="list.post_reply">

			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				sets: false,
				list: []
			}
		},
		onLoad(e) {
			console.log(e)
			var that = this
			var datas = {
				cid: e.cid,
				id: e.id
			}
			console.log(datas)
			this.$api('/portal/index/details', {
				datas: datas
			}, function(res) {
				console.log(res)
				that.list = res.data.data
				var jweixin = require('jweixin-module')

				console.log(jweixin)
				var urls = window.location.href
				that.$api('/portal/index/jsconfig', {
					datas: {
						url: urls
					}
				}, function(res) {
					console.log(res)
					var s = res.data.data
					jweixin.config({
						debug: false,
						appId: s.appId,
						timestamp: s.timestamp,
						nonceStr: s.nonceStr,
						signature: s.signature,
						jsApiList: ["updateTimelineShareData", "updateAppMessageShareData"]
					});
					jweixin.ready(function() {
						jweixin.updateTimelineShareData({
							title: that.list.post_title, // 分享标题
							link: urls, // 分享链接，该链接域名或路径必须与当前页面对应的公众号JS安全域名一致
							imgUrl: 'http://api.haimiantv.cn/upload/default/20200426/86ea4921376b6656f24fbb40e674b361.png', // 分享图标
							success: function() {
								// 设置成功
								console.log(1)

							}
						})
						jweixin.updateAppMessageShareData({
							title: that.list.post_title, // 分享标题
							desc: that.list.post_content, // 分享描述
							link: urls, // 分享链接，该链接域名或路径必须与当前页面对应的公众号JS安全域名一致
							imgUrl: 'http://api.haimiantv.cn/upload/default/20200426/86ea4921376b6656f24fbb40e674b361.png', // 分享图标
							success: function() {
								// 设置成功
							}
						})



					})
					jweixin.error(function(res) {
						console.log(res)
					})
				})
			})
		},
		methods: {
			zhankai() {
				this.sets = !this.sets
			}
		}
	}
</script>

<style>
	@import url("./index-wxq.css");

	.hInfos img {
		display: block;
		max-width: 100% !important;
	}

	.hInfos p {
		max-width: 100% !important;
	}

	img {

		max-width: 100% !important;
	}

	.orimg {
		width: 100%;
		margin: 20rpx 0;
	}
</style>
<style scoped>
	.hInfos>>>img {
		max-width: 100% !important;
	}

	.hInfos>>>p {
		width: 100% !important;
	}
</style>
